using Digitalmes.Core.Configuration;

namespace Digitalmes.AvaloniaUI.ViewModels;

/// <summary>
/// 菜单 ViewModel。
/// </summary>
public sealed class MenuViewModel : ViewModelBase
{
    /// <summary>
    /// 菜单项集合
    /// </summary>
    public ObservableCollection<MenuItemViewModel> MenuItems { get; set; } = [];

    public MenuViewModel()
    {
        var items = AssetsConfigHelper.Get<List<MenuItemViewModel>>(AssetsConstants.MenuFileName);
        if (items != null)
        {
            MenuItems = [.. items.Where(m => !m.Disabled)];
        }
    }
}
